﻿// Decompiled with JetBrains decompiler
// Type: MCM.LightInject.ImmutableList`1
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Diagnostics.CodeAnalysis;

#nullable disable
namespace MCM.LightInject
{
  [ExcludeFromCodeCoverage]
  internal sealed class ImmutableList<T>
  {
    public static readonly ImmutableList<T> Empty = new ImmutableList<T>();
    public readonly T[] Items;
    public readonly int Count;

    public ImmutableList(ImmutableList<T> previousList, T value)
    {
      this.Items = new T[previousList.Items.Length + 1];
      Array.Copy((Array) previousList.Items, (Array) this.Items, previousList.Items.Length);
      this.Items[this.Items.Length - 1] = value;
      this.Count = this.Items.Length;
    }

    private ImmutableList() => this.Items = new T[0];

    public ImmutableList<T> Add(T value) => new ImmutableList<T>(this, value);
  }
}
